import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/login/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/admin/acl/index/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/admin/acl/index/logout',
    method: 'post'
  })
}

// 发送验证码
export function sendSms(data) {
  return request({
    url: '/user/login/sendSms',
    method: 'post',
    data
  })
}

// 重置密码
export function resetPwd(data) {
  return request({
    url: '/user/login/resetPwd',
    method: 'post',
    data
  })
}

// 登录验证
export function loginVerifyApi(data) {
  return request({
    url: '/user/login/loginVerify',
    method: 'post',
    data
  })
}

// 获取用户信息
export function getUserInfoApi() {
  return request({
    url: '/user/login/getUserInfo',
    method: 'get'
  })
}

// 关联用户信息
export function relationApi(data) {
  return request({
    url: '/user/login/relation',
    method: 'post',
    data
  })
}

// 用户配置搜索
export function useSetting(data) {
  return request({
    url: '/hq/clientRelation/search',
    method: 'post',
    data
  })
}

// 添加父客户
export function addParentClient(data) {
  return request({
    url: '/hq/clientRelation/insertBigClient',
    method: 'POST',
    data
  })
}

// 添加子客户
export function addSonClient(data) {
  return request({
    url: '/hq/clientRelation/insertSmallClient',
    method: 'POST',
    data
  })
}

// 查询父客户
export function getParentClient() {
  return request({
    url: '/hq/clientRelation/selectBigClient',
    method: 'GET'
  })
}

// 客户配置修改

export function khupdate(data) {
  return request({
    url: '/hq/clientRelation/update',
    method: 'post',
    data
  })
}

// 删除客户配置
export function khdelete(data) {
  return request({
    url: `/hq/clientRelation/deleteById/${data.id}`,
    method: 'post',
    data
  })
}
